Skip to content

fix: repair milestone-escrow CI build and tests - #429

Merged
godamongstmen897 merged 1 commit into
Goldii-locks:mainfrom
iexwr:fix/ci-test-build
Sep 1, 2026
Merged

fix: repair milestone-escrow CI build and tests#429
godamongstmen897 merged 1 commit into
Goldii-locks:mainfrom
iexwr:fix/ci-test-build

Conversation

@iexwr

@iexwr iexwr commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Repairs the repo-wide CI failure so the test suite builds and runs again on a clean checkout.

Root causes fixed

  1. Test modules lacked #[cfg(test)] in contracts/milestone-escrow/src/lib.rs. Without it, dev-dependencies were referenced during the wasm32 build, failing CI compilation.
  2. setup_funded_escrow was private and Address::generate needed soroban_sdk::testutils::Address, so admin_override_cancel_tests.rs could not compile as a sibling module.
  3. Double authentication bug in admin_override_cancel_refund: called admin.require_auth() then require_admin (which also calls admin.require_auth()). env-host 22.1.3 rejects the nested frame with Error(Auth, ExistingValue), failing 8 tests.
  4. Missing snapshot files for admin_override_cancel_tests (untracked in main), which fail CI on a fresh checkout.

Validation

  • cargo test for milestone-escrow: 463 passed, 0 failed.
  • Values and assertions across all other tests are unchanged.

- annotate test modules with #[cfg(test)] so the wasm build succeeds
  without dev-dependencies
- make setup_funded_escrow pub(crate) and fix test imports so sibling
  test modules can use it (Address::generate requires testutils trait)
- remove redundant admin.require_auth() before require_admin in
  admin_override_cancel_refund; require_admin already performs the
  signature check, and env-host 22.1.3 rejects the double auth with
  Error(Auth, ExistingValue)
- fund a terminal-state cancel test through the zero-balance boundary
  guard in cancel_escrow so its invalid-amount assertion stays intact
- add missing admin_override_cancel_tests snapshot files (untracked,
  would otherwise fail CI on a fresh checkout)
@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

Hey @iexwr! 👋 It looks like this PR isn't linked to any issue.

If this PR is for one of the issues assigned to you as part of a Wave, please link it to ensure your contribution is tracked properly. You can do this by adding a keyword to the PR description (e.g., Closes #123), or by clicking a button below:

Issue Title
#323 Optimize storage keys footprint for emergency_pause Link to this issue
#321 Handle zero/empty balances inside emergency_pause Link to this issue

ℹ️ Learn more about linking PRs to issues

@godamongstmen897
godamongstmen897 merged commit da596c0 into Goldii-locks:main Sep 1, 2026
1 check passed
godamongstmen897 added a commit to Jessepriase/escrow-contract that referenced this pull request Sep 1, 2026
…sed-milestone case

Two things kept this from compiling and passing.

The emergency-pause guard read DataKey::EmergencyPaused, which does not
exist:

  error[E0599]: no variant or associated item named `EmergencyPaused`
                found for enum `DataKey`

This contract has two separate pause flags -- DataKey::Ep for the
emergency pause (set by emergency_pause_admin_override, read by
ensure_not_paused) and DataKey::Paused for admin_pause_escrow. The
comment and the Error::Paused return both describe the emergency one,
so the guard now reads DataKey::Ep. The branch's own CancelLock check
is left as-is, since it returns EscrowLocked rather than the error
ensure_not_paused would give.

The new test test_cancel_escrow_all_milestones_released_still_succeeds
then failed. Its premise -- "no business rule blocks it" -- is no longer
true: cancel_escrow rejects a zero contract balance with InvalidAmount,
and releasing the only milestone empties the contract, so the balance
guard fired rather than anything to do with milestone status.

The test now mints 1 stroop back to the contract before cancelling, the
same workaround Goldii-locks#429 used for the same guard. That keeps it testing what
it claims -- that Released milestones do not themselves block a cancel --
instead of re-testing the balance guard.

538 tests passing / WASM release build OK
godamongstmen897 added a commit to Esbeevybz/escrow-contract that referenced this pull request Sep 1, 2026
The conflict was just a module declaration; it now sits under
#[cfg(test)] alongside the others, matching what Goldii-locks#429 established.

Two compile fixes in the new suite:

- setup_funded_escrow was not in scope. Imported from crate::test, the
  same way admin_override_cancel_tests.rs does it.
- DataKey::YieldRateBps does not exist. admin_set_yield_rate persists
  the rate as the yield_rate field of the YieldConfig entry under
  DataKey::YieldConfig, so read_yield_rate reads that instead. None
  still means "never written", which is what the no-mutation cases want.

Three of the new tests then failed, and they were right to. They pause
with emergency_pause and expect admin_set_yield_rate to return Paused,
but it called only assert_not_paused, which reads DataKey::Paused --
the flag admin_pause_escrow sets. The emergency pause is a separate,
stronger freeze recorded under DataKey::Ep, and nothing was checking it
here, so a yield-rate change went straight through an emergency pause
while the weaker admin pause blocked it.

admin_set_yield_rate now rejects under either flag. That is the
hardening this PR set out to add; the tests had simply reached for the
pause that was not wired up. No existing test asserted the old
behaviour.

558 tests passing / WASM release build OK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants